﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/static/include/top.jsp"%>
<%@page import="java.lang.Math" %>
<%@page import="java.lang.String" %>
<script>document.title="催报报表";</script>
<script type="text/javascript">
function delSelected(){
	var tids = "";
	var temp = document.getElementsByName("chk");
	for(var i=0;i<temp.length;i++){
         if(temp[i].checked==true){
         //alert(temp[i].value);
         tids = tids + temp[i].value + ",";
     }
 	 }
	
	var dot = tids.lastIndexOf(",");
	if(dot == -1){
		layer.alert("请选择要删除的催报信息");
		return;
	}else {
		tids = tids.substring(0,dot);
	} 
	
	layer.confirm("确定要删除选中的催报信息吗？", function(){
		$.ajax({
			   type: "GET",
			   async: false,
			   url: '${baseURL}/monitor/delpush',
			   data: {ids : tids},
			   dataType: "json",
			   success: function(data){
		     	if(data.result=="OK"){
		     		layer.msg(data.message, 1, 1, function(){
		     			document.forms[0].submit();
		     		});		     		
		     	}else{
		     		layer.msg("删除失败，请重试", 1);
		     		return;
		     	}
			}
		});
	});	
}
function selectAll(checkAllFlag) {
	var checkArray = document.getElementsByName("chk");
	for (var i = 0; i < checkArray.length; i++) {
		checkArray[i].checked = checkAllFlag;
	}
}
function clearInput() {
	$("#tit").val("");
	$("#con").val("");
	$("#uni").val("");
}
function cbDetail(id){
	//alert(id);
	openWin("企业浏览","${baseURL}/monitor/listdetail?id="+id,900,500);
}
function cblDetail(id){
	//alert(id);
	openWin("当前催报企业","${baseURL}/monitor/llistdetail?id="+id,900,500);
}
function addMonitor(){
	openWin("设置报表催报","${baseURL}/monitor/setcalls",1000,500,reload);
}
function reload()
{
	searchForm.submit();
}
</script>
  <table>
	<tbody>
		<tr>
			<th><img src="${ctx}/static/images/pages/cen/rig/ico_01.png"
				align="absmiddle">&nbsp;催报报表</th>
		</tr>
      <tr class="tab_grey">
      <td>
		<form name="searchForm" action="" method="post">
			
			<img src="${baseURL}/static/images/tab/ico.png" width="20" height="10" />标题：
			<input type="text" name="title" id="tit" value="${param['title']}" size="20" class="tab_textbut"/>
			&nbsp;&nbsp;&nbsp;
			<img src="${baseURL}/static/images/tab/ico.png" width="20" height="10" />内容：
			<input type="text" name="content" id="con" value="${param['content']}" size="20" class="tab_textbut"/>
			&nbsp;&nbsp;&nbsp;
			<img src="${baseURL}/static/images/tab/ico.png" width="20" height="10" />催报单位：
			<input type="text" name="unit" id="uni" value="${param['unit']}" size="20" class="tab_textbut"/>
			<a class="tab_but" href="#" onclick="searchForm.submit();return false;">查询</a>
			<a class="tab_but" href="#" onclick="delSelected();return false;">删除选中</a>
			<a class="tab_but" href="#" onclick="clearInput();return false;">清空</a>
			<a class="tab_but" href="#" onclick="addMonitor();return false;">催报</a>
		</form>
    </td>
    </tr>
    </tbody>
  </table>
  <br />
	<c:if test="${empty obj}">
		<b>没有符合条件的记录。</b>
	</c:if>
<c:if test="${not empty obj}">
  <table id="listTable">
  <tbody>
    <tr>
    	<th width="5%"><input type="checkbox" onclick="selectAll(this.checked);"></th>
        <th width="20%">标题</th>
		<th width="25%">内容</th>
		<th width="10%">催报频率</th>
		<th width="10%">催报延迟</th>
		<th width="8%">报表总数</th>
		<th width="8%">企业总数</th>
		<th width="14%">已报总数</th>
    </tr>
    <c:forEach var="oneRow" items="${obj}">
    		
    <tr>
    	<td align="left"><input name="chk" type="checkbox" id="chk" value="${oneRow.id}" /></td>
      	<td align="left">${oneRow.billboardTitle}</td>
		<td align="left">${oneRow.billboardContent}</td>
		<c:choose>
		<c:when test="${oneRow.dateType==0}"><td align="left">月</td></c:when>
		<c:when test="${oneRow.dateType==1}"><td align="left">年</td></c:when>
		<c:when test="${oneRow.dateType==2}"><td align="left">半年</td></c:when>
		<c:when test="${oneRow.dateType==3}"><td align="left">季度</td></c:when>
		</c:choose>
		<c:choose>
		<c:when test="${oneRow.offset>=0}"><td align="left">滞后${oneRow.offset}天</td></c:when>
		<c:when test="${oneRow.offset<0}"><td align="left">提前${oneRow.offset < 0 ? -oneRow.offset:oneRow.offset}天</td></c:when>
		</c:choose>
		<td align="left">${oneRow.reportSum}</td>
		
		<td align="left" style="color:blue;"><a href="#" onclick="cbDetail('${oneRow.id}');">${oneRow.userSum}</a></td>
		
		<c:choose>
		<c:when test="${oneRow.reportSum>0}"><td align="left" style="color:blue;"><a href="#" onclick="cblDetail('${oneRow.id}');">已上报:${oneRow.reportEnd}<br/>已完成上报的:<fmt:formatNumber type="number" value="${(oneRow.reportEnd/oneRow.reportSum)*100}" maxFractionDigits="2"/>%</a></td></c:when>
		<c:when test="${oneRow.reportSum<=0}"><td align="left" style="color:blue;"><a href="#" onclick="cblDetail('${oneRow.id}');">已上报:0<br/>已完成上报的:100%</a></td></c:when>
		</c:choose>
    </tr>
    </c:forEach>
    </tbody>
  </table>
</c:if>

<%@ include file="/static/include/bottom.jsp"%>
